<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../common/top.jsp" flush="false"></jsp:include>
    <!--客户管理-->
</head>
<!-- 头部区域 -->
<body>
<div class="layui-layout layui-layout-admin">
    <jsp:include page="../common/header.jsp" flush="false"></jsp:include>
    <jsp:include page="../common/slideNav.jsp" flush="false"></jsp:include>
    <div class="layui-body">
        <div class="layadmin-tabsbody-item layui-show">
            <div class="layui-fluid">
                <div class="layui-card">
                    <div class="layui-form layui-card-header layuiadmin-card-header-auto main_tool" lay-filter="layadmin-userfront-formlist">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">账号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="account" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">电话</label>
                                <div class="layui-input-block">
                                    <input type="text" name="tel" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">昵称</label>
                                <div class="layui-input-block">
                                    <input type="text" name="nicheng" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">性别</label>
                                <div class="layui-input-block tool_select">
                                    <select name="sex">
                                        <option value="">请选择性别</option>
                                        <option value="0">男</option>
                                        <option value="1">女</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">认证状态</label>
                                <div class="layui-input-block tool_select time_input_block">
                                    <select name="rz_state">
                                        <option value="">请选择认证状态</option>
                                        <option value="0">未认证</option>
                                        <option value="1">实名认证</option>
                                        <option value="2">资质认证</option>
                                        <option value="3">经纪人认证</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">注册时间</label>
                                <div class="layui-input-block time_input_block">
                                    <input type="text" class="layui-input" id="test-laydate-range-date" placeholder=" - " lay-key="1">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button class="layui-btn layuiadmin-btn-useradmin layui-btn-sm" lay-submit="" lay-filter="manage_search">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body">
                        <div style="padding-bottom: 10px;">
                            <%--<button class="layui-btn layuiadmin-btn-useradmin" data-type="batchdel">删除</button>--%>
                            <button class="layui-btn layuiadmin-btn-useradmin" data-type="add">新增</button>
                        </div>
                        <table class="layui-hide" id="account" lay-filter="account"></table>
                        <script type="text/html" id="bar_bianji">
                            <a href="javascript:void(0)" class="layui-btn layui-btn-xs" lay-event="xiangqing">详情</a>
                            <a class="layui-btn layui-btn-xs layui-bg-orange" lay-event="jinyan">禁言</a>
                            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="dongjie">冻结</a>
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--禁言弹框-->
<div id="jinyanbox" class="layui-form hide_this" lay-filter="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item" pane="">
        <label style="width: 100px;" class="layui-form-label">选取禁言的栏目</label>
        <div class="layui-input-block">
            <input type="checkbox" name="dongtai" lay-skin="primary" title="发布动态" checked="">
            <input type="checkbox" name="guangchang" lay-skin="primary" title="发布广场信息">
            <input type="checkbox" name="zixun" lay-skin="primary" title="咨询评论">
            <input type="checkbox" name="zhaopin" lay-skin="primary" title="发布招聘">
            <input type="checkbox" name="qiuzhi" lay-skin="primary" title="发布求职">
            <input type="checkbox" name="fbfangyuan" lay-skin="primary" title="发布房源">
            <input type="checkbox" name="pingjia" lay-skin="primary" title="房源评价">
            <input type="checkbox" name="dongtai" lay-skin="primary" title="房源动态">
        </div>
    </div>
    <div class="btn_wrap">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" value="确认" class="layui-btn">
        <input onclick="layer.closeAll()" type="button"  lay-filter="back" value="返回" class="layui-btn">
    </div>
</div>
<!--冻结弹框-->
<div id="dongjiebox" class="layui-form hide_this layui-form-pane" lay-filter="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <div class="layui-form-item">
        <div class="btn_wrap">
            <div class="layui-inline">
                <label class="layui-form-label">冻结天数</label>
                <div class="layui-input-inline">
                    <input type="text" name="dongjie" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
    </div>
    <div class="btn_wrap">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" value="确认" class="layui-btn">
        <input onclick="layer.closeAll()" type="button"  lay-filter="back" value="返回" class="layui-btn">
    </div>
</div>
<script>
    $(function () {
        layui.use(['element', 'layer', 'form', 'layedit', 'laydate', 'table'], function() {
            var element = layui.element, //导航的hover效果、二级菜单等功能，需要依赖element模块
                layer = layui.layer, //弹窗模块
                layedit = layui.layedit, //编辑器
                laydate = layui.laydate, //日期选择器
                form = layui.form, //表单
                table = layui.table //表格
            /*日期范围*/
            laydate.render({
                elem: '#test-laydate-range-date',
                range: true
            });
            //监听用户管理搜索
            form.on('submit(manage_search)', function(data) {
                layer.msg(JSON.stringify(data.field));
                return false;
            });
            //用户管理
            table.render({
                elem: '#account',
                id:'account',
                data: [{
                    "id1": "这个是账号"
                    ,"id2": "15355554444"
                    ,"id3": "李思思"
                    ,"id4": "13655445554"
                    ,"id5": "经纪人"
                    ,"id6": "女"
                    ,"id7": "实名认证"
                    ,"id8": "全案总代"
                    ,"id9": "微信"
                    ,"id10": "2019-09-90"
                }]
                ,
                cols: [
                    [{
                        type: 'checkbox',
                        fixed: 'left'
                    }, {
                        field: 'id1',
                        title: '账号',
                        sort: true
                    }, {
                        field: 'id2',
                        title: '登录账号',
                        minWidth: 100
                    }, {
                        field: 'id3',
                        title: '昵称',
                    }, {
                        field: 'id4',
                        title: '电话'
                    }, {
                        field: 'id5',
                        title: '类型',
                        minWidth: 300,
                    }, {
                        field: 'id6',
                        width: 120,
                        title: '性别'
                    }, {
                        field: 'id7',
                        title: '认证状态'
                    }, {
                        field: 'id8',
                        title: '标签'
                    }, {
                        field: 'id9',
                        title: '三方绑定',
                        sort: true
                    }, {
                        field: 'id10',
                        title: '注册时间',
                        sort: true
                    }, {
                        title: '操作',
                        width: 160,
                        align: 'center',
                        fixed: 'right',
                        toolbar: '#bar_bianji'
                    }]
                ],
                page: true,
                cellMinWidth: 80,
                limit: 30,
                height: 'full-220',
                text: '对不起，加载出现异常！'
            });
            //事件
            var active = {
                //这里的account是table的id
                add: function(){
                    parent.location.href="/addCustomer";
                }
            };
            //监听工具条  account是对应的table的lay-filter的值
            table.on('tool(account)', function(obj){
                var data = obj.data;//获得当前行数据
                var layEvent = obj.event; //获得 lay-event 对应的值
                var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）
                if(obj.event === 'xiangqing'){
                    layer.msg("详情")
                    parent.location.href="/changeCustomerDetails";

                }if(obj.event === 'dongjie'){
                    layer.open({
                        type: 1,
                        title: '冻结登录权限'
                        , area: ['650px', 'auto']
                        , closeBtn: 1
                        , skin: 'layui-layer-admin'
                        , content: $("#dongjiebox")
                        , success: function (layero, index) {
                            form.render(null, 'layuiadmin-form-useradmin');
                            //监听提交
                            form.on('submit(LAY-user-front-submit)', function (data) {
                                var field = data.field; //获取提交的字段
                                //提交 Ajax 成功后，关闭当前弹层并重载表格
                                layer.msg(JSON.stringify(data.field));
                                //$.ajax({});
                                layui.table.reload('quanxian'); //重载表格
                                layer.close(index); //执行关闭
                            });
                        }
                    })
                }else if(obj.event === 'jinyan'){
                    layer.open({
                        type: 1,
                        title: '禁言'
                        , area: ['650px', 'auto']
                        , closeBtn: 1
                        , skin: 'layui-layer-admin'
                        , content: $("#jinyanbox")
                        , success: function (layero, index) {
                            form.render(null, 'layuiadmin-form-useradmin');
                            //监听提交
                            form.on('submit(LAY-user-front-submit)', function (data) {
                                var field = data.field; //获取提交的字段
                                //提交 Ajax 成功后，关闭当前弹层并重载表格
                                layer.msg(JSON.stringify(data.field));
                                //$.ajax({});
                                layui.table.reload('quanxian'); //重载表格
                                layer.close(index); //执行关闭
                            });
                        }
                    })
                }
            });
            /*绑定按钮事件 添加删除等功能按钮*/
            $('.layui-btn.layuiadmin-btn-useradmin').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
        });
    })
</script>

</body>

</html>